package com.atguigu.ggkt.vod.controller;
import com.atguigu.ggkt.swagger.result.Result;
import com.atguigu.ggkt.vod.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * 文件上传管理
 */
@Api("文件上传管理")
//@CrossOrigin
@RestController
@RequestMapping("/admin/vod/file")
public class FileController {
    @Autowired
    private FileService fileService;
    @ApiOperation("文件上传")
    @PostMapping("/upload")
    public Result upload(
            @ApiParam(name = "file",value = "文件",required = true)
            @RequestParam MultipartFile file){
        String url = fileService.upload(file);
        return Result.ok(url);
    }
}

